package com.matt.foundation.vo.course;

import com.matt.domain.TeachingArea;
import com.matt.domain.course.CoursePlan;
import com.matt.foundation.constant.CourseConstant;
import lombok.Data;


/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/19
 * *******************************
 */
@Data
public class CoursePlanDetailVo {

    private String planId;

    private Long beginTime;

    private Long endTime;

    private Integer courseType;

    private String courseEarlyId;

    private String content;

    private String teachingAreaId;

    private String teachingAreaName;

    private String teacherId;

    private String teacherName;

    private String typeName;

    private Integer week;

    private String name;

    public static CoursePlanDetailVo of(CoursePlan coursePlan, TeachingArea teachingArea /*, CoursePlanExtension extension*/) {
        CoursePlanDetailVo vo = new CoursePlanDetailVo();
        vo.setPlanId(coursePlan.getId());
        vo.setCourseEarlyId(coursePlan.getCourseEarlyId());
        vo.setBeginTime(coursePlan.getBeginTime().getTime());
        vo.setEndTime(coursePlan.getEndTime().getTime());
        vo.setCourseType(coursePlan.getCourseType());
        vo.setCourseEarlyId(coursePlan.getCourseEarlyId());
        vo.setTeachingAreaId(coursePlan.getTeachingAreaId());
        vo.setTeachingAreaName(teachingArea.getName());
        vo.setTeacherId(coursePlan.getTeacherId());
        vo.setTeacherName(coursePlan.getTeacherName());
        vo.setTypeName(coursePlan.getTypeName());
        if (coursePlan.getCourseType() == CourseConstant.CourseType.SAT.codeOf())
            vo.setWeek(Integer.valueOf(coursePlan.getTypeName()));
        vo.setName(coursePlan.getCourseName());
//        vo.setContent(extension.getLinkItems());
        return vo;
    }
}
